<?php
namespace Home\Controller;
use Common\Library\BusinessException;
use Common\Library\Constant;
use Common\Vendor\Hook\BaseHook;
use Think\Cache\Driver\Redis;
use Think\Controller;
use Common\Library\Http\Request;
use Common\Library\Http\Response;
use Think\Log;

/*
 * 渠道管理
 * */
class ChannelManageController extends Controller {

    public function __construct()
    {
        parent::__construct();
        header("Access-Control-Allow-Origin: *");
    }

    /*
     * 获取渠道管理列表
     * @author yurong
     * */
    public function getChannelManage(){
        $p = $_GET['p']?$_GET['p']:1;
        $where['status'] = 1;
        $field= "id,title,icon,desc,number,url,number";
        $order ='sort desc';
        $page = ($p-1)*10;
        $limit = "$page,10";
        $List = D("AdminChannelManage")->getList($where,$field,$order,$limit);
        if($List){
            $ret['code'] = 0;
            $ret['msg'] = "请求成功";
            $ret['data'] = $List;
        }else{
            $ret['code'] = 400;
            $ret['msg'] = "没有数据";
            $ret['data'] = [];
        }
        Response::format($ret);
        $this->ajaxReturn($ret);
    }
}
